/*
 * @(#)cn.design.pattern.iterator 2020/4/24/0024
 *
 * Copy Right@ 人人译视界
 */


package cn.design.pattern.iterator;

import java.util.Iterator;
import java.util.List;

/**
 * <pre>
 * @author tuwei
 *
 * @version 0.9
 *
 * 修改版本: 0.9
 * 修改日期: 2020/4/24/0024
 * 修改人 :  tuwei
 * 修改说明: 初步完成
 * 复审人 ：
 * </pre>
 */
public class OutputImpl {
	List<College> collegeList;

	public OutputImpl(List<College> collegeList) {
		this.collegeList = collegeList;
	}

	// 遍历所有学院，然后调用printDepartment
	public void printCollege() {
		Iterator<College> iterator = collegeList.iterator();
		while(iterator.hasNext()) {
			College next = iterator.next();
			System.out.println("=========college=======" + next.getName());
			printDepartment(next.createIterator());
		}
	}
	public void printDepartment(Iterator<Department> iterator) {
		while(iterator.hasNext()) {
			Department department = iterator.next();
			System.out.println(department.getName());
		}
	}
}
